﻿using UnityEngine;
using System.Collections;
using System;
using System.Runtime.CompilerServices;
using Assets.Game.scripts;

namespace Game.Scripts.Managers {

    [Serializable]
    public class Resource {

        public Resource(ResourceEnum type, uint amount)
        {
            this.type = type;
            this.amount = amount;   //magazzino locale del building o globale del resource manager
        }

        public ResourceEnum type;
        public uint amount;

        [MethodImpl(MethodImplOptions.Synchronized)]
        public bool hasAmount(uint amount) {
            return this.amount >= amount;
        }

        [MethodImpl(MethodImplOptions.Synchronized)]
        public void deposit(uint amount) {
            this.amount += amount;
        }

        [MethodImpl(MethodImplOptions.Synchronized)]
        public void withdraw(uint amount) {
            this.amount -= amount;
        }
    }

}